import { getCurrentInstance } from "vue";

/**
 * 获取当前应用实例,并将全局配置导出
 */
export default function globalCurrentInstance() {
    const instance = getCurrentInstance();
    if (!instance) {
        throw new Error('globalCurrentInstance must be called within a setup function');
    }
    const { appContext } = instance;
    const globalConfig = appContext.config.globalProperties;
    return {
        globalConfig
    };
}